//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 15/03/2010
//-----------------------------------------------------------------------------
#include "factory.h"
using namespace bend2d;

auto_ptr<Factory> Factory::m_Instance;
DummyObjectCreator Factory::m_DummyObjectCreator;

Factory::Factory() :
    m_ObjectCreatorDelegation(NULL)
{
    m_ObjectCreatorDelegation = &m_DummyObjectCreator;
}

Factory* Factory::GetInstance()
{
    if(NULL == m_Instance.get())
        m_Instance.reset(new Factory());
    return m_Instance.get();
}

void Factory::RegistryObjectCreator(ObjectCreator* creator)
{
    m_ObjectCreatorDelegation = creator;
}

ObjectCreator* Factory::AccessObjectCreator() const
{
    return m_ObjectCreatorDelegation;
}

